package com.p2p.auth.service.remote;


import com.p2p.auth.common.base.JsonResult;
import com.p2p.auth.controller.Routes;
import com.p2p.auth.domain.dto.TemplateMsgDTO;
import com.p2p.auth.service.hystrix.SmsRemoteHystrix;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

/**
 * Created by lipei on 2018/3/3.
 */
@FeignClient(name= "MSG-SERVER" , fallback = SmsRemoteHystrix.class)
@Component
public interface ISms {

    //获取token
    @RequestMapping(value= Routes.SMS_GET_TOKEN, method = RequestMethod.GET)
    @ResponseBody
    public JsonResult getToken();

    //发送短信验证码
    @RequestMapping(value= Routes.SMS_SEND_VERIFICATION_CODE, method = RequestMethod.GET)
    @ResponseBody
    public JsonResult sendVerificationCode(@RequestParam(value = "mobile") String mobile, @RequestParam(value = "token") String token, @RequestParam(value = "tempId") String tempId);


    //校验短信验证码
    @RequestMapping(value= Routes.SMS_VALIDATE_CODE, method = RequestMethod.GET)
    @ResponseBody
    public JsonResult validateCode(@RequestParam(value = "mobile") String mobile, @RequestParam(value = "code") String code);

    //发送模版短信
    @RequestMapping(value= Routes.SMS_SEND_TEMPLATE_MSG, method = RequestMethod.POST)
    @ResponseBody
    public JsonResult sendTemplateMsg(@RequestBody TemplateMsgDTO req);

}
